home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
monitor
/
timelo.arc
/
TIMELOG.DOC
Wrap
Text File
|
1988-07-06
|
13KB
|
334 lines
TIMELOG.DOC contained in TIMELOG.ARC - Network Poor User LOG program
A simple but effective system of monitoring user use of the network.
Created by: Bruce Gregory [75600,26]
Currently used on SFT Netware 2.1 SMC/ARCNET MS-DOS 3.2
At present, has not been tested with other system configurations.
One 3rd party program is required, this example requires the
use of Norton's TimeMark.exe; using the short name TM.exe, the rest
of the work is done with batch files and DOS environment strings.
TM.exe advantage is it's ability to maintain several stopwatches (4).
The following is assumed in order for all to function properly:
Each, or a test user has their own home subdirectory i.e. SYS:CHRIS
This home subdirectory is their first mapped search drive & that
SYS:PUBLIC is the second search drive, others required can follow.
The SYS:LOGIN directory is not a mapped as a search drive.
LOGIN AS SUPERVISOR (on a sunday perhaps)
1. Create a subdirectory off the SYS: root called \TIMELOG
2. Give the Group EVERYONE (or test user) trustee rights to this directory
3. Place the following lines in the beginning of the
system login script or user login script, whichever you prefer.
DOS SET USER = "%LOGIN_NAME"
DOS SET STA# = "%P_STATION"
If you are using only the SYSTEM login script file:
add the following line.
EXIT "BEGIN"
Else place it at the end of the individual user's login script.
This will call the BEGIN.BAT file on exit from the login script.
4. Locate and delete all copies of LOGIN.EXE & LOGOUT.EXE except for
those located in the SYS:LOGIN subdirectory.
In SYS:LOGIN rename LOGOUT.EXE to BYENET.EXE
and LOGIN.EXE to NETLOGIN.EXE
Flag these files SRO
5. Create and copy the following files to the SYS:PUBLIC area and flag SRO
NOTE: If using a test user copy to the user's home directory
Norton's TM.EXE program
BEGIN.BAT - Explained below
LOGIN.BAT - " " titled for the \PUBLIC subdirectory
LOGOUT.BAT - " " " " " " "
Note: There are (2) versions of the LOGOUT.BAT file, please verify.
6. Create and copy the following files to the SYS:LOGIN area and flag SRO
LOGIN.BAT - Explained below titled for the \LOGIN subdirectory
LOGOUT.BAT - " " " " " " "
Note: There are (2) versions of the LOGOUT.BAT file, please verify.
The following batch files are required, explanations to follow:
***BEGIN.BAT***
rem ********* Begin.bat file for SYS:PUBLIC DIRECTORY **********
rem
echo off
cls
TM START "%USER% @Sta_%STA#% LogIN time " /C4/L >> \TIMELOG\%USER%.LOG
echo . >>\TIMELOG\%USER%.LOG
cd\%user%
echo cd\%user% >\home.bat
IF X%1==XNOMENU GOTO BYPASS
menu user
rem Else exit to DOS
:BYPASS
******END BEGIN.BAT*******
Lets break these commands down.
Suppose you had a user named CHRIS, s)he logs in to the system
from physical station 00000000000F at 10:21 am
[TM START] start the clock
["%USER% @Sta_%STA#% LogIN time "] "Quoted" string (a Norton requirement)
String converts to: ->CHRIS @Sta_00000000000F LogIN time <-
because we previously passed Novell's LOGIN_NAME & P_STATION
to the (set) DOS environment string as %USER% & %STA#% respectively.
[/C4] Use Clock #4 (avoids conflict w/ clock #1, default for no params)
[/L] Left justify the string for the file
[>>] Dos redirection ( double >> ) for append to file
[\TIMELOG\] The subdirectory where the target files reside.
[%USER%.LOG] The target file which is CHRIS.LOG, if the target
file does'nt exist it will be created by the batch file.
[echo . >>\TIMELOG\%USER%.LOG] Add a period and force a CR/LF sequence
Now if we type(ed) the file: TYPE \TIMELOG\CHRIS.LOG the result,
(providing it was the first login ever) would be as follows:
CHRIS @Sta_00000000000F LogIN time 10:21 am, Wednesday, July 6, 1988 .
(eof)
Suppose now that CHRIS logs off the network at 3:52 PM, the logout
batch file would send a logout string with a time calculation providing
us with the following in the CHRIS.LOG file.
CHRIS @Sta_00000000000F LogIN time 10:21 am, Wednesday, July 6, 1988 .
CHRIS @Sta_00000000000F LogOUT time 3:52 pm, Wednesday, July 6, 1988
5 hours, 30 minutes, 12 seconds .
(eof)
A similar login the following day would append CHRIS.LOG & produce:
CHRIS @Sta_00000000000F LogIN time 10:21 am, Wednesday, July 6, 1988 .
CHRIS @Sta_00000000000F LogOUT time 3:52 pm, Wednesday, July 6, 1988
5 hours, 30 minutes, 12 seconds .
CHRIS @Sta_00000000000F LogIN time 9:00 am, Thursday, July 7, 1988 .
CHRIS @Sta_00000000000F LogOUT time 4:00 pm, Thursday, July 7, 1988
7 hours, 0 minutes, 10 seconds .
(eof)
Additional lines in this batch file are:
[cd\%user%] Change directories to SYS:CHRIS
[echo cd\%user% > \home.bat] Creates a HOME.BAT file with the following
line in it: CD\CHRIS
This so the user can always return to their
home directory by entering HOME on the
command line. This file is always refreshed.
[IF X%1==XNOMENU GOTO BYPASS] If Chris logged in i.e. LOGIN CHRIS NOMENU
then bypass the menu calling program
[menu user] Don't confuse USER with %USER% - this line will only
work if there is a USER.MNU file in SYS:PUBLIC.
It could be "menu main" etc.. Change to suit.
Also requires MENU.EXE
[:BYPASS] End of batch file, just exit to the operating system
*****END EXPLANATION OF BEGIN.BAT******
*****LOGIN.BAT******
rem ********* Login.bat file for SYS:PUBLIC & SYS:LOGIN
rem
rem Only required in SYS:PUBLIC if search mapping EXcludes
rem the \LOGIN subdirectory
rem also to force a logout write to the user.log before a re-login
rem while logged onto the network.
echo off
cls
f:
rem if there is no f:\public then no need to write to the log
rem chances are they are not on the network at all.
IF NOT EXIST F:\PUBLIC\*.* GOTO BYPASS
rem
rem However, if they are currently logged in, force a logout first
rem ******* send the logout date & time to the userlog
TM STOP "%USER% @Sta_%STA#% LogOUT time " /C4/L >>\TIMELOG\%USER%.LOG
echo . >>\TIMELOG\%USER%.LOG
CD\LOGIN
:BYPASS
rem Use this next line only if using the ANSI.SYS driver
rem or delete it as you prefer, it's not required, I use it for format.
echo ^[[15B
rem LOGIN.EXE has been renamed NETLOGIN.EXE
netlogin %1 %2 %3 %4 %5
*****END LOGIN.BAT*****
*****LOGOUT.BAT****** for SYS:PUBLIC
rem ************** logout.bat file in SYS:PUBLIC DIRECTORY**********
rem
rem Only required if search mapping EXcludes the \LOGIN subdirectory
REM
echo off
cls
f:
cd\login
rem now call the extended version of logout.bat
rem located in the sys:login directory
logout
*****END LOGOUT.BAT******* FOR SYS:PUBLIC
*****LOGOUT.BAT******** FOR SYS:LOGIN
rem ************** logout.bat file in SYS:LOGIN DIRECTORY***********
rem
echo off
cls
rem ******* send the logout date & time to the userlog
TM STOP "%USER% @Sta_%STA#% LogOUT time " /C4/L >>\TIMELOG\%USER%.LOG
echo . >>\TIMELOG\%USER%.LOG
rem LOGOUT.EXE has been renamed to BYENET.EXE
byenet
*****END LOGOUT.BAT******* FOR SYS:LOGIN
7. The following examples demonstrate tracking application use by user to
a \TIMELOG\USERNAME.APL file. Replace .APL with .LOG if you prefer
to have login/out and application use in the same file.
So as not to interfere with the login/logout timekeeping the clock
#3 is used for applications.
ADDITIONAL NOTE: when redirecting with the %USER% string a single
batch file can by used by all users which avoids
individual batch file customization.
*****A SAMPLE LOTUS-123 BATCH FILE USING CLOCK #3 ********
called by user BRIAN
echo off
cls
CD\123
TM START "%USER% START LOTUS 123 " /C3/L >>\TIMELOG\%USER%.APL
echo . >>\TIMELOG\%USER%.APL
LOTUS
TM STOP "%USER% STOP LOTUS 123 " /C3/L >>\TIMELOG\%USER%.APL
echo . >>\TIMELOG\%USER%.APL
HOME
*****END LOTUS 123 BATCH FILE EXAMPLE******
Resulting in a \TIMELOG\BRIAN.ASC file that might look like:
BRIAN START LOTUS 123 2:32 pm, Tuesday, July 5, 1988 .
BRIAN STOP LOTUS 123 5:15 pm, Tuesday, July 5, 1988
2 hours, 42 minutes, 48 seconds ...
BRIAN START LOTUS 123 9:16 am, Wednesday, July 6, 1988 .
BRIAN STOP LOTUS 123 4:32 pm, Wednesday, July 6, 1988
7 hours, 15 minutes, 38 seconds ...
(eof)
*****A SAMPLE MULTIMATE BATCH FILE USING CLOCK #3 ********
called by user JAY
echo off
cls
TM START "%USER% START MULTIMATE " /C3/L >>\TIMELOG\%USER%.APL
echo . >>\TIMELOG\%USER%.APL
cd\wordpro
MM
TM STOP "%USER% STOP MULTIMATE " /C3/L >>\TIMELOG\%USER%.APL
echo ... >>\TIMELOG\%USER%.APL
home
*****END MULTIMATE BATCH FILE EXAMPLE******
Resulting in a \TIMELOG\JAY.ASC file that might look like:
JAY START MULTIMATE 12:28 pm, Thursday, June 30, 1988 .
JAY STOP MULTIMATE 12:51 pm, Thursday, June 30, 1988
23 minutes, 15 seconds ...
JAY START LOTUS 123 2:32 pm, Tuesday, July 5, 1988 .
JAY STOP LOTUS 123 5:15 pm, Tuesday, July 5, 1988
2 hours, 42 minutes, 48 seconds ...
JAY START MULTIMATE 10:24 am, Wednesday, July 6, 1988 .
JAY STOP MULTIMATE 12:14 pm, Wednesday, July 6, 1988
1 hour, 50 minutes, 11 seconds ...
JAY START MULTIMATE 12:19 pm, Wednesday, July 6, 1988 .
JAY STOP MULTIMATE 12:24 pm, Wednesday, July 6, 1988
5 minutes, 18 seconds ...
JAY START MULTIMATE 12:43 pm, Wednesday, July 6, 1988 .
JAY STOP MULTIMATE 12:56 pm, Wednesday, July 6, 1988
12 minutes, 38 seconds ...
8. This example, and for now the last, enables a second use of the
%STA#% information. Suppose you only have two workstations with
the ability to work with graphics programs and they are; physical
station# 000000000002 and physical station# 00000000000A:
echo off
cls
if X%
IF X%STA#%==X000000000002 GOTO DOGRAPH
IF X%STA#%==X00000000000A GOTO DOGRAPH
GOTO BYPASS
:DOGRAPH
cd\GrafStuf
GRAPHDO
:BYPASS
HOME
Simple, but effective. Of course you could create the example batch
file with prompts to the user so as to let them know that they are
logged into the wrong workstation for graphics etc.
******** C L O S I N G N O T E S **************
I must admit that my approach is less than elegant, has it's down sides
and in no way compares with some of the packaged stuff on the market today.
It has provided me with useful information in determining user activity
on a (16) station (22) user system of moderate use and I hope you find
it to be helpful in some way. One up side is it's cost! Zilch.
Questions, comments and/or suggestions are welcome.
Bruce Gregory
SOS MicroResources
20 Troy Road
Whippany, NJ 07981
(201) 503-0393
(eof)